feat(authz): ADR-0066 D4 UI half — gate actions by requiredPermissions#1920
Merged
Conversation
…pability for The server already enforces action requiredPermissions (403, source of truth); this derives the same gate in the UI so a button the user can't use is hidden. - ActionEngine.getActionsForLocation: filter out actions whose requiredPermissions are not ALL held by the caller's systemPermissions. Fail-OPEN when systemPermissions is unknown (the server still 403s; hiding on missing data is a worse regression than a button that errors clearly). Mirrors the App/nav gate. - permissions: expose `systemPermissions` + `hasCapabilities(required)` on the PermissionContext; MePermissionsProvider wires them from /me/permissions (which already returns systemPermissions). usePermissions fallback + the legacy PermissionProvider fail-open. - app-shell: useConsoleActionRuntime injects user.systemPermissions into the action runtime context so the engine gate can read it. - Test: ActionEngine.requiredPermissions.test.ts (show/hide/AND/fail-open). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The UI half of ADR-0066 D4 (dual-surface action gates). The framework server already enforces
action.requiredPermissions(403 — the source of truth; objectstack-ai/objectstack#2238). This derives the same gate in the console so a button the user can't use is hidden rather than shown-then-403'd.Changes
@object-ui/coreActionEngine.getActionsForLocation: filters out actions whoserequiredPermissionsaren't ALL held by the caller'ssystemPermissions. Fail-OPEN whensystemPermissionsis unknown (undefined) — the server still 403s, and hiding on missing data is a worse regression than a button that errors clearly. Mirrors the existing App/navrequiredPermissionsgate.@object-ui/permissions:PermissionContextValueexposessystemPermissions: string[]+hasCapabilities(required).MePermissionsProviderwires them from/me/permissions(which already returnssystemPermissions).usePermissionsno-provider fallback + the legacy role-basedPermissionProviderfail-open.@object-ui/app-shelluseConsoleActionRuntime: injectsuser.systemPermissionsinto the action runtime context so the engine gate can read it.Tests
ActionEngine.requiredPermissions.test.ts(+5): no-gate / held / not-held / AND-semantics / fail-open.@object-ui/core+@object-ui/permissionstype-check clean; ActionEngine suite (15) green.Pairs with framework ADR-0066 D4 (#2238, merged). UI gating is derived/secondary — server enforcement is the security boundary.
🤖 Generated with Claude Code